<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="$gqt/admin/css/layui.css">
    <link rel="stylesheet" href="$gqt/admin/css/pro_build.css">
    <script src="http://lib.sinaapp.com/js/jquery/1.4.2/jquery.min.js"></script>
    <script src="/GQT/public/static/admin/js/layui.js"></script>
    <script src="http://lib.sinaapp.com/js/jquery/1.4.2/jquery.min.js"></script>
    <style>
        .score_main {
            margin-top: 50px !important;
            margin: 0 auto;
        }

        th {
            text-align: center !important;
        }

        select {
            height: 36px;
            border-color: cadetblue;
        }

        input {
            height: 30px;
        }

        .score_float {
            position: relative !important;
            float: right !important;
        }

        form {

            width: 100%;
            display: inline-flex;
        }
    </style>
</head>

<body>
    <div class="layui-col-md9 score_main">
        <div id="search">
            <form action="{:url('admin/excel/export')}" method="post" id="myform" onkeypress="if(event.keyCode==13||event.which==13){return false;}">
                <div class="layui-form-item score_float">
                    <label class="layui-form-label">系别：</label>
                    <!-- <div class="layui-input-block"> -->
                        <select name="dept" id="dept" onchange="dept_1(this.options[this.options.selectedIndex].value)">
                            <option value="">请选择系别</option>
                            <option value="地震科学系">地震科学系</option>
                            <option value="防灾工程系">防灾工程系</option>
                            <option value="防灾仪器系">防灾仪器系</option>
                            <option value="灾害信息工程系">灾害信息工程系</option>
                            <option value="经济管理系">经济管理系</option>
                            <option value="人文社科系">人文社科系</option>
                            <option value="外语系">外语系</option>
                        </select>
                    <!-- </div> -->
                </div>
                <div class="layui-form-item score_float">
                    <label class="layui-form-label">专业：</label>
                    <select id="major" onchange="major_1(this.options[this.options.selectedIndex].value)">
                        <option value="">请选择专业</option>
                    </select>
                </div>
                <div class="layui-form-item score_float">
                    <label class="layui-form-label">年级：</label>
                    <select name="class" id="grade" onchange="grade_1(this.options[this.options.selectedIndex].value)">
                        <option value="">请选择年级</option>
                        <option value="1">大一</option>
                        <option value="2">大二</option>
                        <option value="3">大三</option>
                        <option value="4">大四</option>
                    </select>
                </div>
                <div class="layui-form-item score_float">
                    <label class="layui-form-label">班级：</label>
                    <input type="text" name="class" onchange="select_class(this.value)" /> </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">学号：</label>
                    <input type="text" name="stu_id" onchange="select_stu_id(this.value)" />
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <input type="submit" name="excel"  value="导出excel" />
                </div>
            </form>
        </div>

        <div id="content">
            <table class="table table-striped table-bordered table-condensed layui-table" style="text-align:center">
                <tr>
                    <th>学号</th>
                    <th>姓名</th>
                    <th>系别</th>
                    <th>专业</th>
                    <th>项目学分</th>
                    <th>德</th>
                    <th>智</th>
                    <th>体</th>
                    <th>其他</th>
                </tr>
            </table>
        </div>
    </div>
</body>
<script>
//请选择系别
    function dept_1(vals) {
        var area = document.getElementById("major");
        var grade = document.getElementById("grade").value;
        switch (vals) {
            case "地震科学系": area.innerHTML = " <option >请选择专业</option><option value='地球物理学''>地球物理学</option><option value='勘查技术与工程'>勘查技术与工程</option><option value='地质学''>地质学</option ><option value='资源勘查工程'>资源勘查工程</option><option value='地下水科学与工程'>地下水科学与工程</option><option value='地理科学'>地理科学</option>";
                break;
            case "防灾工程系": area.innerHTML = " <option>请选择专业</option><option value='勘察技术与工程''>勘察技术与工程</option><option value='土木工程'>土木工程</option><option value='工程管理''>工程管理</option ><option value='测绘工程'>测绘工程</option><option value='地质工程'>地质工程</option>";
                break;
            case "防灾仪器系": area.innerHTML = " <option>请选择专业</option><option value='电气工程及自动化''>电气工程及自动化</option><option value='测控技术与仪器'>测控技术与仪器</option><option value='通信工程''>通信工程</option >";
                break;
            case "灾害信息工程系": area.innerHTML = " <option>请选择专业</option><option value='信息管理与信息系统''>信息管理与信息系统</option><option value='计算机科学与技术'>计算机科学与技术</option><option value='网络工程''>网络工程</option ><option value='物联网专业''>物联网专业</option >";
                break;
            case "经济管理系": area.innerHTML = " <option >请选择专业</option><option value='公共事业管理''>公共事业管理</option><option value='金融学'>金融学</option><option value='会计学''>会计学</option ><option value='工商管理''>工商管理</option >";
                break;
            case "人文社科系": area.innerHTML = " <option>请选择专业</option><option value='汉语言文学''>汉语言文学</option><option value='广告学'>广告学</option>";
                break;
            case "外语系": area.innerHTML = " <option >请选择专业</option><option value='英语专业''>英语专业</option>";
                break;
            default: alert("error");
        }
        $.ajax({
            url: 'score_select_dept',
            type: 'post',
            data: { dept: vals,grade: grade },
            success: function (data) {
                $('table tbody td').remove();//删除之前的数据
                var item;
                var obj = JSON.parse(data);
                $.each(obj, function (i, result) {
                    item = "<tr><td>" + result['stu_id'] + "</td><td>" + result['name'] + "</td><td>" + result['dept'] + "</td><td>" + result['major'] + "</td><td>" + result['pro_score'] + "</td><td>" + result['virture'] + "</td><td>" + result['wit'] + "</td><td>" + result['sport'] + "</td><td>" + result['other_score'] + "</td></tr>";

                    $('.table').append(item);

                });

            }
        })

    }
    //请选择专业
    function major_1(vals) {
        var dept = document.getElementById("dept").value;
        var grade = document.getElementById("grade").value;
        $.ajax({
            url: 'score_select_major',
            type: 'post',
            data: { dept: dept, major: vals ,grade:grade},
            success: function (data) {
                $('table tbody td').remove();//删除之前的数据
                var item;
                var obj = JSON.parse(data);
                $.each(obj, function (i, result) {

                    item = "<tr><td>" + result['stu_id'] + "</td><td>" + result['name'] + "</td><td>" + result['dept'] + "</td><td>" + result['major'] + "</td><td>" + result['pro_score'] + "</td><td>" + result['virture'] + "</td><td>" + result['wit'] + "</td><td>" + result['sport'] + "</td><td>" + result['other_score'] + "</td></tr>";

                    $('.table').append(item);

                });

            }
        })
    }
    //请选择年级
    function grade_1(vals) {
        var dept = document.getElementById("dept").value;
        var major = document.getElementById("major").value;
        $.ajax({
            url: 'score_select_grade',
            type: 'post',
            data: { dept: dept, major: major, grade: vals },
            success: function (data) {
                $('table tbody td').remove();//删除之前的数据
                var item;
                var obj = JSON.parse(data);
                $.each(obj, function (i, result) {

                    item = "<tr><td>" + result['stu_id'] + "</td><td>" + result['name'] + "</td><td>" + result['dept'] + "</td><td>" + result['major'] + "</td><td>" + result['pro_score'] + "</td><td>" + result['virture'] + "</td><td>" + result['wit'] + "</td><td>" + result['sport'] + "</td><td>" + result['other_score'] + "</td></tr>";

                    $('.table').append(item);

                });

            }
        })
    }
    //班级
    function select_class(vals) {
        // var vals=document.getElementById("class").value;
        // console.log(vals);
        $.ajax({
            url: 'score_class',
            type: 'post',
            data: { class: vals },
            success: function (data) {
                $('table tbody td').remove();//删除之前的数据
                var item;
                var obj = JSON.parse(data);
                $.each(obj, function (i, result) {

                    item = "<tr><td>" + result['stu_id'] + "</td><td>" + result['name'] + "</td><td>" + result['dept'] + "</td><td>" + result['major'] + "</td><td>" + result['pro_score'] + "</td><td>" + result['virture'] + "</td><td>" + result['wit'] + "</td><td>" + result['sport'] + "</td><td>" + result['other_score'] + "</td></tr>";

                    $('.table').append(item);

                });

            }
        })
    }
    //学号
    function select_stu_id(vals) {
        // var vals=document.getElementById("class").value;
        // console.log(vals);
        $.ajax({
            url: 'select_stu_id',
            type: 'post',
            data: { stu_id: vals },
            success: function (data) {
                $('table tbody td').remove();//删除之前的数据
                var item;
                var obj = JSON.parse(data);
                $.each(obj, function (i, result) {
                    item = "<tr><td>" + result['stu_id'] + "</td><td>" + result['name'] + "</td><td>" + result['dept'] + "</td><td>" + result['major'] + "</td><td>" + result['pro_score'] + "</td><td>" + result['virture'] + "</td><td>" + result['wit'] + "</td><td>" + result['sport'] + "</td><td>" + result['other_score'] + "</td></tr>";
                    $('.table').append(item);
                });
            }
        })
    }
    function submitForm(){
//获取form表单对象
    var form = document.getElementById("myform");
    form.submit();//form表单提交
}
</script>

</html>